#import "BookItem.h"

@implementation BookItem

@synthesize pkId;
@synthesize bookId;
@synthesize bookCode;
@synthesize bookName;
@synthesize bookEnglishName;
@synthesize bookEditorInfo;

@synthesize bookContentInfo;
@synthesize bookAuthorInfo;
@synthesize bookCatalog;
@synthesize bookFreeContent;
@synthesize bookIcon;
@synthesize bookIconSmall;

@synthesize bookShot;
@synthesize book4PhoneResource;
@synthesize book4PhoneResourceType;
@synthesize book4PadResource;
@synthesize book4PadResourceType;
@synthesize bookSeries;
@synthesize bookPrice;

@synthesize bookPrice2;
@synthesize bookPricePrint;
@synthesize bookLanguage;
@synthesize bookAuthor;
@synthesize bookTranslator;
@synthesize bookPress;

@synthesize bookIssn;
@synthesize bookPressTime;
@synthesize bookPages;
@synthesize bookWords;
@synthesize bookScore;

@synthesize bookCategory;
@synthesize bookCategory1;
@synthesize bookHot;
@synthesize bookStar;
@synthesize bookState;

@synthesize bookDownFlag;
@synthesize bookDownCount;
@synthesize bookFocusCount;
@synthesize bookCommentCount;
@synthesize bookBuyFlag;
@synthesize bookMark;
@synthesize bookDelete;

@synthesize bookExt1;
@synthesize bookExt2;
@synthesize bookExt3;
@synthesize bookExt4;
@synthesize bookExt5;

@synthesize bookApprovalTime;
@synthesize bookFavorite;
@synthesize bookIconFlag;

#pragma mark -
#pragma mark NSCoder methods

- (void)encodeWithCoder:(NSCoder *)coder {
    [coder encodeObject:[self pkId] forKey:@"pkId"];
    [coder encodeObject:[self bookId] forKey:@"bookId"];
    [coder encodeObject:[self bookCode] forKey:@"bookCode"];
    [coder encodeObject:[self bookName] forKey:@"bookName"];
    [coder encodeObject:[self bookEnglishName] forKey:@"bookEnglishName"];
    [coder encodeObject:[self bookEditorInfo] forKey:@"bookEditorInfo"];

    [coder encodeObject:[self bookContentInfo] forKey:@"bookContentInfo"];
    [coder encodeObject:[self bookAuthorInfo] forKey:@"bookAuthorInfo"];
    [coder encodeObject:[self bookCatalog] forKey:@"bookCatalog"];
    [coder encodeObject:[self bookFreeContent] forKey:@"bookFreeContent"];
    [coder encodeObject:[self bookIcon] forKey:@"bookIcon"];
    [coder encodeObject:[self bookIconSmall] forKey:@"bookIconSmall"];
    
    [coder encodeObject:[self bookShot] forKey:@"bookShot"];
    [coder encodeObject:[self book4PhoneResource] forKey:@"book4PhoneResource"];
    [coder encodeObject:[self book4PhoneResourceType] forKey:@"book4PhoneResourceType"];
    [coder encodeObject:[self book4PadResource] forKey:@"book4PadResource"];
    [coder encodeObject:[self book4PadResourceType] forKey:@"book4PadResourceType"];
    [coder encodeObject:[self bookSeries] forKey:@"bookSeries"];
    [coder encodeObject:[self bookPrice] forKey:@"bookPrice"];
    
    [coder encodeObject:[self bookPrice2] forKey:@"bookPrice2"];
    [coder encodeObject:[self bookPricePrint] forKey:@"bookPricePrint"];
    [coder encodeObject:[self bookLanguage] forKey:@"bookLanguage"];
    [coder encodeObject:[self bookAuthor] forKey:@"bookAuthor"];
    [coder encodeObject:[self bookTranslator] forKey:@"bookTranslator"];
    [coder encodeObject:[self bookPress] forKey:@"bookPress"];
    
    [coder encodeObject:[self bookIssn] forKey:@"bookIssn"];
    [coder encodeObject:[self bookPressTime] forKey:@"bookPressTime"];
    [coder encodeObject:[self bookPages] forKey:@"bookPages"];
    [coder encodeObject:[self bookWords] forKey:@"bookWords"];
    [coder encodeObject:[self bookScore] forKey:@"bookScore"];
    
    [coder encodeObject:[self bookCategory] forKey:@"bookCategory"];
    [coder encodeObject:[self bookCategory1] forKey:@"bookCategory1"];
    [coder encodeObject:[self bookHot] forKey:@"bookHot"];
    [coder encodeObject:[self bookStar] forKey:@"bookStar"];
    [coder encodeObject:[self bookState] forKey:@"bookState"];
    
    [coder encodeObject:[self bookDownFlag] forKey:@"bookDownFlag"];
    [coder encodeObject:[self bookDownCount] forKey:@"bookDownCount"];
    [coder encodeObject:[self bookFocusCount] forKey:@"bookFocusCount"];
    [coder encodeObject:[self bookCommentCount] forKey:@"bookCommentCount"];
    [coder encodeObject:[self bookBuyFlag] forKey:@"bookBuyFlag"];
    [coder encodeObject:[self bookMark] forKey:@"bookMark"];
    [coder encodeObject:[self bookDelete] forKey:@"bookDelete"];
    
    [coder encodeObject:[self bookExt1] forKey:@"bookExt1"];
    [coder encodeObject:[self bookExt2] forKey:@"bookExt2"];
    [coder encodeObject:[self bookExt3] forKey:@"bookExt3"];
    [coder encodeObject:[self bookExt4] forKey:@"bookExt4"];
    [coder encodeObject:[self bookExt5] forKey:@"bookExt5"];
    
    [coder encodeObject:[self bookApprovalTime] forKey:@"bookApprovalTime"];
    [coder encodeObject:[self bookFavorite] forKey:@"bookFavorite"];
    [coder encodeObject:[self bookIconFlag] forKey:@"bookIconFlag"];
}

- (id)initWithCoder:(NSCoder *)coder {
    if (self = [super init]) {
		[self setPkId:[coder decodeObjectForKey:@"pkId"]];
		[self setBookId:[coder decodeObjectForKey:@"bookId"]];
		[self setBookCode:[coder decodeObjectForKey:@"bookCode"]];
		[self setBookName:[coder decodeObjectForKey:@"bookName"]];
		[self setBookEnglishName:[coder decodeObjectForKey:@"bookEnglishName"]];
		[self setBookEditorInfo:[coder decodeObjectForKey:@"bookEditorInfo"]];
        
		[self setBookContentInfo:[coder decodeObjectForKey:@"bookContentInfo"]];
		[self setBookAuthorInfo:[coder decodeObjectForKey:@"bookAuthorInfo"]];
		[self setBookCatalog:[coder decodeObjectForKey:@"bookCatalog"]];
		[self setBookFreeContent:[coder decodeObjectForKey:@"bookFreeContent"]];
		[self setBookIcon:[coder decodeObjectForKey:@"bookIcon"]];
		[self setBookIconSmall:[coder decodeObjectForKey:@"bookIconSmall"]];
        
		[self setBookShot:[coder decodeObjectForKey:@"bookShot"]];
        [self setBook4PhoneResource:[coder decodeObjectForKey:@"book4PhoneResource"]];
        [self setBook4PhoneResourceType:[coder decodeObjectForKey:@"book4PhoneResourceType"]];
        [self setBook4PadResource:[coder decodeObjectForKey:@"book4PadResource"]];
        [self setBook4PadResourceType:[coder decodeObjectForKey:@"book4PadResourceType"]];
        [self setBookSeries:[coder decodeObjectForKey:@"bookSeries"]];
        [self setBookPrice:[coder decodeObjectForKey:@"bookPrice"]];
        
        [self setBookPrice2:[coder decodeObjectForKey:@"bookPrice2"]];
        [self setBookPricePrint:[coder decodeObjectForKey:@"bookPricePrint"]];
        [self setBookLanguage:[coder decodeObjectForKey:@"bookLanguage"]];
        [self setBookAuthor:[coder decodeObjectForKey:@"bookAuthor"]];
        [self setBookTranslator:[coder decodeObjectForKey:@"bookTranslator"]];
        [self setBookPress:[coder decodeObjectForKey:@"bookPress"]];
        
        [self setBookIssn:[coder decodeObjectForKey:@"bookIssn"]];
        [self setBookPressTime:[coder decodeObjectForKey:@"bookPressTime"]];
        [self setBookPages:[coder decodeObjectForKey:@"bookPages"]];
        [self setBookWords:[coder decodeObjectForKey:@"bookWords"]];
        [self setBookScore:[coder decodeObjectForKey:@"bookScore"]];
        
        [self setBookCategory:[coder decodeObjectForKey:@"bookCategory"]];
        [self setBookCategory1:[coder decodeObjectForKey:@"bookCategory1"]];
        [self setBookHot:[coder decodeObjectForKey:@"bookHot"]];
        [self setBookStar:[coder decodeObjectForKey:@"bookStar"]];
        [self setBookState:[coder decodeObjectForKey:@"bookState"]];
        
        [self setBookDownFlag:[coder decodeObjectForKey:@"bookDownFlag"]];
        [self setBookDownCount:[coder decodeObjectForKey:@"bookDownCount"]];
        [self setBookFocusCount:[coder decodeObjectForKey:@"bookFocusCount"]];
        [self setBookCommentCount:[coder decodeObjectForKey:@"bookCommentCount"]];
        [self setBookBuyFlag:[coder decodeObjectForKey:@"bookBuyFlag"]];
        [self setBookMark:[coder decodeObjectForKey:@"bookMark"]];
        [self setBookDelete:[coder decodeObjectForKey:@"bookDelete"]];
        
        [self setBookExt1:[coder decodeObjectForKey:@"bookExt1"]];
        [self setBookExt2:[coder decodeObjectForKey:@"bookExt2"]];
        [self setBookExt3:[coder decodeObjectForKey:@"bookExt3"]];
        [self setBookExt4:[coder decodeObjectForKey:@"bookExt4"]];
        [self setBookExt5:[coder decodeObjectForKey:@"bookExt5"]];
        
        [self setBookApprovalTime:[coder decodeObjectForKey:@"bookApprovalTime"]];
        [self setBookFavorite:[coder decodeObjectForKey:@"bookFavorite"]];
        [self setBookIconFlag:[coder decodeObjectForKey:@"bookIconFlag"]];
    
    }
    return self;
}

#pragma mark -
#pragma mark Memory methods

- (void)dealloc {
	[pkId release];
	[bookId release];
	[bookCode release];
	[bookName release];
	[bookEnglishName release];
	[bookEditorInfo release];

    [bookContentInfo release];
	[bookAuthorInfo release];
	[bookCatalog release];
	[bookFreeContent release];
	[bookIcon release];
    [bookIconSmall release];
    
	[bookShot release];
    [book4PhoneResource release];
    [book4PhoneResourceType release];
	[book4PadResource release];
	[book4PadResourceType release];
	[bookSeries release];
	[bookPrice release];
    
	[bookPrice2 release];
	[bookPricePrint release];
	[bookLanguage release];
	[bookAuthor release];
	[bookTranslator release];
	[bookPress release];
    
	[bookIssn release];
	[bookPressTime release];
	[bookPages release];
	[bookWords release];
	[bookScore release];
    
	[bookCategory release];
	[bookCategory1 release];
	[bookHot release];
	[bookStar release];
	[bookState release];
    
    [bookDownFlag release];
    [bookDownCount release];
    [bookFocusCount release];
    [bookCommentCount release];
    [bookBuyFlag release];
    [bookMark release];
    [bookDelete release];
    
    [bookExt1 release];
    [bookExt2 release];
    [bookExt3 release];
    [bookExt4 release];
    [bookExt5 release];
    
    [bookApprovalTime release];
    [bookFavorite release];
    [bookIconFlag release];
    
    [super dealloc];
}

- (id)copyWithZone:(NSZone *)zone  {  
    
    BookItem *copy = [[[self class] allocWithZone:zone] init];  
    copy->pkId = [pkId copy];
    copy->bookId = [bookId copy];
	copy->bookCode = [bookCode copy];
	copy->bookName = [bookName copy];
	copy->bookEnglishName = [bookEnglishName copy];
    copy->bookEditorInfo = [bookEditorInfo copy];
    
    copy->bookContentInfo = [bookContentInfo copy];
    copy->bookAuthorInfo = [bookAuthorInfo copy];
    copy->bookCatalog = [bookCatalog copy];
    copy->bookFreeContent = [bookFreeContent copy];
    copy->bookIcon = [bookIcon copy];
    copy->bookIconSmall = [bookIconSmall copy];
    
    copy->bookShot = [bookShot copy];
    copy->book4PhoneResource = [book4PhoneResource copy];
    copy->book4PhoneResourceType = [book4PhoneResourceType copy];
    copy->book4PadResource = [book4PadResource copy];
    copy->book4PadResourceType = [book4PadResourceType copy];
    copy->bookSeries = [bookSeries copy];
    copy->bookPrice = [bookPrice copy];
    
    copy->bookPrice2 = [bookPrice2 copy];
    copy->bookPricePrint = [bookPricePrint copy];
    copy->bookLanguage = [bookLanguage copy];
    copy->bookAuthor = [bookAuthor copy];
    copy->bookTranslator = [bookTranslator copy];
    copy->bookPress = [bookPress copy];
    
    copy->bookIssn = [bookIssn copy];
    copy->bookPressTime = [bookPressTime copy];
    copy->bookPages = [bookPages copy];
    copy->bookWords = [bookWords copy];
    copy->bookScore = [bookScore copy];
    
    copy->bookCategory = [bookCategory copy];
    copy->bookCategory1 = [bookCategory1 copy];
    copy->bookHot = [bookHot copy];
    copy->bookStar = [bookStar copy];
    copy->bookState = [bookState copy];
    
    copy->bookDownFlag = [bookDownFlag copy];
    copy->bookDownCount = [bookDownCount copy];
    copy->bookFocusCount = [bookFocusCount copy];
    copy->bookCommentCount = [bookCommentCount copy];

    copy->bookBuyFlag = [bookBuyFlag copy];
    copy->bookMark = [bookMark copy];
    copy->bookDelete = [bookDelete copy];
    
    copy->bookExt1 = [bookExt1 copy];
    copy->bookExt2 = [bookExt2 copy];
    copy->bookExt3 = [bookExt3 copy];
    copy->bookExt4 = [bookExt4 copy];
    copy->bookExt5 = [bookExt5 copy];
    
    copy->bookApprovalTime = [bookApprovalTime copy];
    copy->bookFavorite = [bookFavorite copy];
    copy->bookIconFlag = [bookIconFlag copy];
    return copy;  
    
}  

- (id)mutableCopyWithZone:(NSZone *)zone  {  
    
    BookItem *copy = NSCopyObject(self, 0, zone);   
    copy->pkId = [pkId mutableCopy]; 
    copy->bookId = [bookId mutableCopy];
	copy->bookCode = [bookCode mutableCopy];
	copy->bookName = [bookName mutableCopy];
	copy->bookEnglishName = [bookEnglishName mutableCopy];
    copy->bookEditorInfo = [bookEditorInfo mutableCopy];
    
    copy->bookContentInfo = [bookContentInfo mutableCopy];
    copy->bookAuthorInfo = [bookAuthorInfo mutableCopy];
    copy->bookCatalog = [bookCatalog mutableCopy];
    copy->bookFreeContent = [bookFreeContent mutableCopy];
    copy->bookIcon = [bookIcon mutableCopy];
    copy->bookIconSmall = [bookIconSmall mutableCopy];
    
    copy->bookShot = [bookShot mutableCopy];
    copy->book4PhoneResource = [book4PhoneResource mutableCopy];
    copy->book4PhoneResourceType = [book4PhoneResourceType mutableCopy];
    copy->book4PadResource = [book4PadResource mutableCopy];
    copy->book4PadResourceType = [book4PadResourceType mutableCopy];
    copy->bookSeries = [bookSeries mutableCopy];
    copy->bookPrice = [bookPrice mutableCopy];
    
    copy->bookPrice2 = [bookPrice2 mutableCopy];
    copy->bookPricePrint = [bookPricePrint mutableCopy];
    copy->bookLanguage = [bookLanguage mutableCopy];
    copy->bookAuthor = [bookAuthor mutableCopy];
    copy->bookTranslator = [bookTranslator mutableCopy];
    copy->bookPress = [bookPress mutableCopy];
    
    copy->bookIssn = [bookIssn mutableCopy];
    copy->bookPressTime = [bookPressTime mutableCopy];
    copy->bookPages = [bookPages mutableCopy];
    copy->bookWords = [bookWords mutableCopy];
    copy->bookScore = [bookScore mutableCopy];
    
    copy->bookCategory = [bookCategory mutableCopy];
    copy->bookCategory1 = [bookCategory1 mutableCopy];
    copy->bookHot = [bookHot mutableCopy];
    copy->bookStar = [bookStar mutableCopy];
    copy->bookState = [bookState mutableCopy];
    
    copy->bookDownFlag = [bookDownFlag mutableCopy];
    copy->bookDownCount = [bookDownCount mutableCopy];
    copy->bookFocusCount = [bookFocusCount mutableCopy];
    copy->bookCommentCount = [bookCommentCount mutableCopy];
    copy->bookBuyFlag = [bookBuyFlag mutableCopy];
    copy->bookMark = [bookMark mutableCopy];
    copy->bookDelete = [bookDelete mutableCopy];
    
    copy->bookExt1 = [bookExt1 mutableCopy];
    copy->bookExt2 = [bookExt2 mutableCopy];
    copy->bookExt3 = [bookExt3 mutableCopy];
    copy->bookExt4 = [bookExt4 mutableCopy];
    copy->bookExt5 = [bookExt5 mutableCopy];
    
    copy->bookApprovalTime = [bookApprovalTime mutableCopy];
    copy->bookFavorite = [bookFavorite mutableCopy];
    copy->bookIconFlag = [bookIconFlag mutableCopy];
    
    return copy;  
}  

@end

@implementation CategoryCount

@synthesize categoryName;
@synthesize categoryCount;

#pragma mark -
#pragma mark Memory methods

- (void)dealloc {
	[categoryName release];
	[categoryCount release];
    
    [super dealloc];
}
@end;

@implementation AdItem

@synthesize adId;
@synthesize adTitle;
@synthesize adAbstract;
@synthesize ad4Phone;
@synthesize ad4Pad;
@synthesize image4Phone;
@synthesize image4Pad;
@synthesize adContent;
@synthesize adState;
@synthesize ext1;
@synthesize ext2;
@synthesize ext3;
@synthesize ext4;
@synthesize ext5;

#pragma mark -
#pragma mark Memory methods

- (void)dealloc {
	[adId release];
	[adTitle release];
    [adAbstract release];
    [ad4Phone release];
    [ad4Pad release];
    [image4Phone release];
    [image4Pad release];
    [adContent release];
    [adState release];
    [ext1 release];
    [ext2 release];
    [ext3 release];
    [ext4 release];
    [ext5 release];
    
    [super dealloc];
}
@end;